﻿using UnityEngine;
using UnityEngine.UI;

public class MemberInfo : MonoBehaviour
{
    public Text txtName, txtId;
    public ChatObject chatObject;
    public ChattingPanel chattingPanel;
    private void Update()
    {
        if (chatObject != null)
        {
            txtName.text = chatObject.Name;
            txtId.text = chatObject.Id;
        }
    }
    public void OnToggleClick(bool flag)
    {
        if (chattingPanel.OriginChatObject == null)
            chattingPanel.OriginChatObject = chattingPanel.ChatObject;
        if (flag)
        {
            if (!chattingPanel.ChatObject.Equals(chatObject))
            {
                chattingPanel.ChatObject = chatObject;
                chattingPanel.ChatType = Chat.Common.ChatType.Private;
            }
            else
                chattingPanel.ChatType = Chat.Common.ChatType.Public;
        }
        else
        {
            chattingPanel.ChatObject = chattingPanel.OriginChatObject;
            chattingPanel.ChatType = Chat.Common.ChatType.Public;
        }
    }
}